package model;

import java.util.*;

import view.TableComponent;

/**
 * This is the highest level model class.
 *
 */
public class GameModel {
	/** Mapping from a position name to a player model. 
	 * Current supported position names: NORTH, SOUTH.
	 */
	private Map<String, PlayerModel> players;
	private TableModel tableModel;
	
	public GameModel() {
		players = new HashMap<String, PlayerModel>();
		tableModel = new TableModel();
		
		
		players.put("NORTH", new PlayerModel("John"));
		players.put("SOUTH", new PlayerModel("Norman"));
	}
	
	public ArrayList<CardStack> getTableCards() {
		return tableModel.data;
	}
	public ArrayList<Card> getPlayerHand(String position) {
		return players.get(position).getCards();
	}
	public String getPlayerName(String position) {
		return players.get(position).name;
	}
	
	public CardStack moveTopFromStack(CardStack stack, int newX, int newY)
	{
		cleanup();
		return tableModel.moveTopFromStack(stack, newX, newY);
	}
	
	public void unhighlightAllStacks()
	{
		cleanup();
		tableModel.unhighlightAllStacks();
	}
	
	public void cleanup()
	{
		tableModel.cleanup();
	}
	
	public void shuffleStack(CardStack stack)
	{
		stack.shuffle();
		cleanup();
	}
	
	
	
}
